cmake_minimum_required(VERSION 3.0.2)
project(simple_loam)

# add_compile_options(-std=c++14)

set(CMAKE_BUILD_TYPE "Release")

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fexceptions")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -pthread -std=c++0x -std=c++14 -fexceptions -Wno-unused-local-typedefs")

find_package(OpenMP QUIET)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}   ${OpenMP_C_FLAGS}")

find_package(catkin REQUIRED COMPONENTS
  geometry_msgs
  nav_msgs
  roscpp
  rospy
  sensor_msgs
  std_msgs
  tf
  livox_ros_driver
)

find_package(PCL REQUIRED)
find_package(Eigen3 REQUIRED)
find_package(Ceres REQUIRED)

catkin_package(
#  INCLUDE_DIRS include
#  LIBRARIES simple_loam
#  CATKIN_DEPENDS geometry_msgs nav_msgs roscpp rospy sensor_msgs std_msgs tf
#  DEPENDS system_lib
)

include_directories(
  include
  ${catkin_INCLUDE_DIRS}
  ${PCL_INCLUDE_DIRS}
  ${CERES_INCLUDE_DIRS}
)

add_executable(CustomMsg2SensorMsg src/CustomMsg2SensorMsg.cpp)
target_link_libraries(CustomMsg2SensorMsg
  ${catkin_LIBRARIES}
  ${PCL_LIBRARIES}
)

add_executable(pcl_learner src/pcl_learner.cpp)
target_link_libraries(pcl_learner
  ${catkin_LIBRARIES}
  ${PCL_LIBRARIES}
)

add_executable(scanRegistration src/scanRegistration.cpp)
target_link_libraries(scanRegistration
  ${catkin_LIBRARIES}
  ${PCL_LIBRARIES}
)

add_executable(laserOdometry src/laserOdometry.cpp include/ikd-Tree/ikd_Tree.cpp)
target_link_libraries(laserOdometry
  ${catkin_LIBRARIES}
  ${PCL_LIBRARIES}
  ${CERES_LIBRARIES}
)


add_executable(laserMapping src/laserMapping.cpp)
target_link_libraries(laserMapping
  ${catkin_LIBRARIES}
  ${PCL_LIBRARIES}
  ${CERES_LIBRARIES}
)
